<template>
  <div>
    <div class="flex justify-between align-center margin-bottom-xs">
      <div class="flex align-center">
        <h3 class="text-center margin-right">生产计划表</h3>
        <check-status-legend />
      </div>
      <el-form
        ref="queryForm"
        :model="queryParams"
        inline
        class="flex align-center"
      >
        <el-form-item label="型号" prop="computerId" style="margin-bottom: 0">
          <el-select
            v-model="queryParams.computerId"
            :loading="isCLoading"
            filterable
            remote
            clearable
            :remote-method="getComputerNameList"
          >
            <el-option
              v-for="dict in computerOptions"
              :key="dict.model"
              :label="dict.name"
              :value="dict.model"
            />
          </el-select>
        </el-form-item>
        <el-form-item
          label="许可状态"
          prop="isLicense"
          style="margin-bottom: 0"
        >
          <el-select v-model="queryParams.isLicense">
            <el-option label="未许可" :value="0"></el-option>
            <el-option label="已许可" :value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item style="margin-bottom: 0">
          <el-button type="success" size="mini" @click="getHomeProductionAll">
            搜索
          </el-button>
          <el-button size="mini" @click="resetQuery">重置</el-button>
          <el-button
            v-if="checkRole(['PMC'])"
            type="primary"
            size="mini"
            @click="$router.push('/www/planSchedule')"
          >
            去排产
          </el-button>
        </el-form-item>
      </el-form>
    </div>

    <el-table
      classs="plan-order-table"
      ref="planOrderRef"
      v-loading="isLoading"
      :data="productionList"
      :height="isTestTabHeight"
      @cell-dblclick="onDbClick"
      @cell-click="onCellClick"
      :cell-class-name="getCellClassName"
      :row-class-name="tableRowClassName"
    >
      <el-table-column prop="date" label="日期" align="center" width="90">
        <template slot-scope="{ row }">
          {{ parseTime(row.date, "{y}-{m}-{d}") }}
        </template>
      </el-table-column>
      <el-table-column prop="computerName" label="型号" align="center">
        <template slot-scope="{ row }">
          <span
            v-if="row.computerName"
            style="text-decoration: underline #d45757"
          >
            {{ row.computerName }}
          </span>
          <span v-else>- - -</span>
        </template>
      </el-table-column>
      <el-table-column prop="customerOrderNo" label="客户订单号" align="center">
        <span slot-scope="scope" v-NoData="scope.row.customerOrderNo"></span>
      </el-table-column>
      <el-table-column
        prop="process"
        label="生产阶段"
        align="center"
        width="90"
      >
        <span slot-scope="scope" v-NoData="scope.row.process"></span>
      </el-table-column>
      <el-table-column prop="num" label="生产数量" align="center" width="90">
        <span slot-scope="scope" v-NoData="scope.row.num"></span>
      </el-table-column>
      <el-table-column
        prop="address"
        label="生产地点"
        align="center"
        width="90"
      >
        <span slot-scope="scope" v-NoData="scope.row.address"></span>
      </el-table-column>
      <el-table-column label="SMT资料" align="center">
        <el-table-column
          prop="pucsStatus"
          label="JS脚本"
          align="center"
          width="90"
        >
          <template slot-scope="{ row }">
            <miss-data
              v-if="row.mapFile[1].length"
              :row="row"
              currentDataName="JS脚本"
              :currentIndex="1"
            >
            </miss-data>
            <template v-else> - - - </template>
          </template>
        </el-table-column>
        <el-table-column
          prop="hardStatus"
          label="硬件资料"
          align="center"
          width="90"
        >
          <template slot-scope="{ row }">
            <miss-data
              v-if="row.mapFile[2].length"
              :row="row"
              currentDataName="硬件资料"
              :currentIndex="2"
            >
            </miss-data>
            <template v-else> - - - </template>
          </template>
        </el-table-column>
        <el-table-column
          prop="softStatus"
          label="软件资料"
          align="center"
          width="90"
        >
          <template slot-scope="{ row }">
            <miss-data
              v-if="row.mapFile[3].length"
              :row="row"
              currentDataName="软件资料"
              :currentIndex="3"
            ></miss-data>

            <template v-else> - - - </template>
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column label="组装资料" align="center">
        <el-table-column
          prop="configStatus"
          label="配置文件"
          align="center"
          width="90"
        >
          <template slot-scope="{ row }">
            <miss-data
              v-if="row.mapFile[4].length"
              :row="row"
              currentDataName="配置文件"
              :currentIndex="4"
            ></miss-data>

            <template v-else> - - - </template>
          </template>
        </el-table-column>
        <el-table-column
          prop="testStatus"
          label="测试上位机"
          align="center"
          width="90"
        >
          <template slot-scope="{ row }">
            <miss-data
              v-if="row.mapFile[5].length"
              :row="row"
              currentDataName="测试上位机"
              :currentIndex="5"
            ></miss-data>
            <template v-else> - - - </template>
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column
        prop="customerStatus"
        label="客户确认状态"
        align="center"
        width="140"
      >
        <template v-slot="{ row, $index }">
          <template v-if="row.id">
            <el-dropdown trigger="click" style="width: 100%">
              <el-button
                :type="typeStatus(row.customerStatus)"
                size="mini"
                plain
                style="width: 100%; font-size: 11px"
              >
                {{ isStatusText(row.customerStatus, row.customerDate) }}
                <i
                  class="el-icon-arrow-down el-icon--right"
                  v-if="checkRole(['product']) && row.num > 0"
                ></i>
              </el-button>
              <el-dropdown-menu slot="dropdown">
                <template v-if="checkRole(['product'])">
                  <el-dropdown-item
                    @click.native="handleCustomerStatus(0, row)"
                  >
                    未确认
                  </el-dropdown-item>
                  <el-dropdown-item
                    @click.native="handleCustomerStatus(1, row)"
                  >
                    已确认
                  </el-dropdown-item>
                  <el-dropdown-item @click.native="handleSelDate(1, row)">
                    选择日期
                  </el-dropdown-item>
                </template>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
          <template v-else>
            <span>- - -</span>
          </template>
        </template>
      </el-table-column>

      <el-table-column
        prop="testStatus"
        label="测试状态"
        align="center"
        width="140"
      >
        <template v-slot="{ row, $index }">
          <template v-if="row.id">
            <el-dropdown trigger="click" style="width: 100%">
              <el-button
                :type="typeStatus(row.testStatus)"
                size="mini"
                plain
                style="width: 100%; font-size: 11px"
              >
                {{ isStatusText(row.testStatus, row.testDate) }}
                <i
                  class="el-icon-arrow-down el-icon--right"
                  v-if="checkRole(['test']) && row.num > 0"
                ></i>
              </el-button>
              <el-dropdown-menu slot="dropdown">
                <template v-if="checkRole(['test'])">
                  <el-dropdown-item @click.native="handleTestStatus(0, row)">
                    未确认
                  </el-dropdown-item>
                  <el-dropdown-item @click.native="handleTestStatus(1, row)">
                    已确认
                  </el-dropdown-item>
                  <el-dropdown-item @click.native="handleSelDate(2, row)">
                    选择日期
                  </el-dropdown-item>
                </template>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
          <template v-else>
            <span>- - -</span>
          </template>
        </template>
      </el-table-column>
      <el-table-column
        prop="isLicense"
        label="许可状态"
        align="center"
        width="90"
      >
        <template v-slot="{ row, $index }">
          <template v-if="row.id">
            <div class="flex justify-center align-center">
              <img
                v-if="row.isLicense === 1"
                src="./imgs/green.png"
                alt="已许可"
                title="已许可"
                width="16px"
                height="16px"
              />
              <img
                v-if="row.isLicense !== 1"
                src="./imgs/red.png"
                alt="未许可"
                title="未许可"
                width="16px"
                height="16px"
              />
            </div>
          </template>
          <template v-else>
            <span>- - -</span>
          </template>
        </template>
      </el-table-column>

      <el-table-column
        prop="isLicense"
        label="任务令"
        align="center"
        width="90"
      >
        <template v-slot="{ row }">
          <div
            v-if="row.id"
            class="flex justify-center align-center"
            @click="handleQrCode(row)"
          >
            <svg
              t="1736758692229"
              class="icon"
              viewBox="0 0 1024 1024"
              version="1.1"
              xmlns="http://www.w3.org/2000/svg"
              p-id="4424"
              width="20"
              height="20"
            >
              <path
                d="M149.897707 387.566843l154.232099 0c49.484303 0 89.577425-40.093122 89.577425-89.577425L393.707231 143.757319C393.707231 94.273016 353.614109 54.179894 304.491005 54.179894L149.897707 54.179894c-49.484303 0-89.577425 40.093122-89.577425 89.577425l0 154.232099C60.320282 347.473721 100.774603 387.566843 149.897707 387.566843zM136.533333 143.757319c0-7.223986 6.140388-13.364374 13.364374-13.364374l154.232099 0c7.223986 0 13.364374 6.140388 13.364374 13.364374l0 154.232099c0 7.223986-6.140388 13.364374-13.364374 13.364374L149.897707 311.353792c-7.223986 0-13.364374-6.140388-13.364374-13.364374L136.533333 143.757319z"
                fill="#575B66"
                p-id="4425"
              ></path>
              <path
                d="M304.491005 628.486772 149.897707 628.486772c-49.484303 0-89.577425 40.093122-89.577425 89.577425l0 154.232099c0 49.484303 40.093122 89.577425 89.577425 89.577425l154.232099 0c49.484303 0 89.577425-40.093122 89.577425-89.577425l0-154.232099C393.707231 668.579894 353.614109 628.486772 304.491005 628.486772zM317.49418 872.296296c0 7.223986-6.140388 13.364374-13.364374 13.364374L149.897707 885.66067c-7.223986 0-13.364374-6.140388-13.364374-13.364374l0-154.232099c0-7.223986 6.140388-13.364374 13.364374-13.364374l154.232099 0c7.223986 0 13.364374 6.140388 13.364374 13.364374L317.49418 872.296296z"
                fill="#575B66"
                p-id="4426"
              ></path>
              <path
                d="M878.797884 54.179894l-154.232099 0c-49.484303 0-89.577425 40.093122-89.577425 89.577425l0 154.232099c0 49.484303 40.093122 89.577425 89.577425 89.577425l154.232099 0c49.484303 0 89.577425-40.093122 89.577425-89.577425L968.375309 143.757319C968.014109 94.273016 927.920988 54.179894 878.797884 54.179894zM891.801058 297.989418c0 7.223986-6.140388 13.364374-13.364374 13.364374l-154.232099 0c-7.223986 0-13.364374-6.140388-13.364374-13.364374L710.840212 143.757319c0-7.223986 6.140388-13.364374 13.364374-13.364374l154.232099 0c7.223986 0 13.364374 6.140388 13.364374 13.364374L891.801058 297.989418z"
                fill="#575B66"
                p-id="4427"
              ></path>
              <path
                d="M673.997884 552.273721c19.865961 0 36.119929-15.892769 35.75873-36.119929 0-19.865961-15.892769-36.119929-36.119929-36.119929l-126.058554 0L547.578131 338.443739c0-19.865961-15.892769-36.119929-36.119929-35.75873-19.865961 0-36.119929 15.892769-36.119929 36.119929L475.338272 480.395062 96.440212 480.395062c-19.865961 0-36.119929 15.892769-36.119929 36.119929 0 19.865961 15.892769 36.119929 36.119929 36.119929l379.620459 0 0 169.04127c0 19.865961 15.892769 36.119929 36.119929 36.119929s36.119929-15.892769 36.119929-36.119929l0-169.04127L673.997884 552.634921z"
                fill="#575B66"
                p-id="4428"
              ></path>
              <path
                d="M932.255379 552.273721c19.865961 0 36.119929-15.892769 35.75873-36.119929 0-19.865961-15.892769-36.119929-36.119929-36.119929l-79.825044 0c-19.865961 0-36.119929 15.892769-36.119929 36.119929 0 19.865961 15.892769 36.119929 36.119929 36.119929L932.255379 552.273721z"
                fill="#575B66"
                p-id="4429"
              ></path>
              <path
                d="M511.8194 166.874074c19.865961 0 36.119929-15.892769 36.119929-36.119929L547.93933 88.855026c0-19.865961-15.892769-36.119929-36.119929-35.75873-19.865961 0-36.119929 15.892769-36.119929 36.119929l0 41.899118C476.06067 150.620106 491.953439 166.874074 511.8194 166.874074z"
                fill="#575B66"
                p-id="4430"
              ></path>
              <path
                d="M511.8194 849.179541c-19.865961 0-36.119929 15.892769-36.119929 36.119929l0 41.899118c0 19.865961 15.892769 36.119929 36.119929 36.119929s36.119929-15.892769 36.119929-36.119929l0-42.260317C547.93933 865.07231 531.685362 849.179541 511.8194 849.179541z"
                fill="#575B66"
                p-id="4431"
              ></path>
              <path
                d="M892.884656 871.573898c0 7.223986-6.140388 13.003175-13.003175 13.003175l-38.648325 0 0 75.129453 38.648325 0c48.761905 0 88.493827-39.731922 88.493827-88.493827l0-43.705115-75.129453 0L893.245855 871.573898z"
                fill="#575B66"
                p-id="4432"
              ></path>
              <path
                d="M879.520282 631.015168l-152.426102 0c-48.761905 0-88.493827 39.731922-88.493827 88.493827l0 152.426102c0 48.761905 39.731922 88.493827 88.493827 88.493827l38.648325 0L765.742504 884.938272l-38.648325 0c-7.223986 0-13.003175-6.140388-13.003175-13.003175l0-152.426102c0-7.223986 6.140388-13.003175 13.003175-13.003175l152.426102 0c7.223986 0 13.003175 6.140388 13.003175 13.003175l0 33.591534L968.014109 753.100529l0-33.591534C968.014109 670.74709 928.282187 631.015168 879.520282 631.015168z"
                fill="#575B66"
                p-id="4433"
              ></path>
            </svg>
          </div>

          <span v-else>- - -</span>
        </template>
      </el-table-column>
    </el-table>

    <el-dialog
      :title="isTitle"
      :visible.sync="dialogVisible"
      width="350px"
      top="2vh"
      center
    >
      <el-date-picker
        v-model="dateTime"
        type="date"
        placeholder="选择日期"
        value-format="timestamp"
        :picker-options="pickerOptions"
        style="width: 100%"
      >
      </el-date-picker>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="handleSubmit"> 确 定 </el-button>
      </span>
    </el-dialog>

    <!-- 任务令 -->
    <el-dialog
      title="任务令"
      :visible.sync="isQrCode"
      width="500px"
      center
      top="-5vh"
    >
      <el-card shadow="hover">
        <div class="text-center">
          <vue-qr
            class="margin-bottom-xs"
            :text="qrCodeObj.qrCode"
            :size="250"
            :margin="10"
          ></vue-qr>

          <el-descriptions direction="vertical" :column="4" border>
            <el-descriptions-item label="产品型号">
              <span v-NoData="qrCodeObj.computerName"></span>
            </el-descriptions-item>
            <el-descriptions-item label="芯片版本">
              <span v-NoData="qrCodeObj.chipVersion"></span>
            </el-descriptions-item>
            <el-descriptions-item label="客户订单号">
              <span v-NoData="qrCodeObj.customerOrderNo"></span>
            </el-descriptions-item>
            <el-descriptions-item label="生产数量">
              <span v-NoData="qrCodeObj.num"></span>
            </el-descriptions-item>
            <el-descriptions-item label="备注" :span="4">
              <span v-NoData="qrCodeObj.remark"></span>
            </el-descriptions-item>
          </el-descriptions>
        </div>
      </el-card>
    </el-dialog>
  </div>
</template>

<script>
import { homeProduction, homeProductionStatus } from "@/api/home/index";
import { computerNameList } from "@/api/third/fileConfig";
import VueQr from "vue-qr";
import CheckStatusLegend from "./checkStatusLegend.vue";

export default {
  name: "proPlanOrder",
  data() {
    return {
      isLoading: true,
      isCLoading: false,
      isQrCode: false,
      qrCodeObj: {},
      isTitle: "",
      dialogVisible: false,
      dateTime: "",
      currentSelTimeType: null,
      currentSelData: {},
      dateRange: [],
      productionList: [],
      computerOptions: [],
      queryParams: {
        computerId: "",
        isLicense: "",
      },
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() <= Date.now() - 24 * 3600 * 1000;
        },
      },
    };
  },
  components: {
    VueQr,
    MissData: () => import("./MissData.vue"),
    CheckStatusLegend
  },
  computed: {
    isToday() {
      return (date) => {
        return (
          this.moment(date).format("YYYY-MM-DD") ===
          this.moment().format("YYYY-MM-DD")
        );
      };
    },
    isTestTabHeight() {
      return "calc(100vh - 200px)";
    },
    hopeDateStyle() {
      return (hopeDate, result) => {
        // 预计时间
        const expectedTime = this.moment(hopeDate);

        const now = this.moment();

        const diffInHours = expectedTime.diff(now, "hours");
        let bgStyle = "";

        if (result === "OK") {
          bgStyle = "bg-green-noHurry ";
        } else if (result === "NG") {
          bgStyle = "bg-danger ";
        } else {
          // 判断时间差
          if (diffInHours <= 8) {
            bgStyle = "bg-danger ";
          } else if (diffInHours <= 16) {
            bgStyle = "bg-warning ";
          } else if (diffInHours <= 32) {
            bgStyle = "bg-yellow ";
          } else {
            bgStyle = "bg-green-noHurry ";
          }
        }
        return bgStyle + `${result === "OK" ? "" : "pointer"} text-black`;
      };
    },
    bgResultStyle() {
      return (result) => {
        if (result === "OK") {
          return "bg-green-noHurry text-black";
        } else if (result === "NG") {
          return "bg-danger text-black";
        } else {
          return "";
        }
      };
    },
    // 客户确认状态选择值
    isStatusText() {
      return (status, date) => {
        switch (status) {
          case 0:
            return "未确认";
          case 1:
            return "已确认";
          case 2:
            const finishedTime = this.moment.unix(date).format("MM/DD");
            return `预计${finishedTime}完成`;
          default:
            return "请选择";
        }
      };
    },
    typeStatus() {
      return (status) => {
        switch (status) {
          case 0:
            return "danger";
          case 1:
            return "success";
          default:
            return "primary";
        }
      };
    },
  },
  created() {
    this.getHomeProductionAll();
  },
  methods: {
    getComputerNameList(name) {
      if (name) {
        this.isCLoading = true;
        computerNameList({ name })
          .then((res) => {
            this.computerOptions = res.data;
            this.isCLoading = false;
          })
          .catch(() => {
            this.isCLoading = false;
          });
      } else {
        this.computerOptions = [];
      }
    },
    resetQuery() {
      this.resetForm("queryForm");
      this.getHomeProductionAll();
    },
    getHomeProductionAll(isUpdate = true) {
      isUpdate && (this.isLoading = true);
      homeProduction({ ...this.queryParams })
        .then((res) => {
          const totalData = res.data;

          this.productionList = this.handleTransData(totalData);

          if (isUpdate) {
            this.$nextTick(() => {
              this.scrollToToday();
            });
          }
        })
        .finally(() => {
          this.isLoading = false;
        });
    },
    scrollToToday() {
      const todayIndex = this.productionList.findIndex((item) =>
        this.isToday(item.date)
      );

      if (todayIndex !== -1) {
        const tableBody =
          this.$refs.planOrderRef.$el.querySelector(".el-table__body");
        const rowElement = tableBody.querySelector(
          `.el-table__row:nth-child(${todayIndex + 1})`
        );
        if (rowElement) {
          const rowTop = rowElement.offsetTop;
          const tableBodyWrapper = this.$refs.planOrderRef.$el.querySelector(
            ".el-table__body-wrapper"
          );
          tableBodyWrapper.scrollTop = rowTop - tableBody.offsetTop;
        }
      }
    },
    handleTransData(totalData) {
      try {
        let newData = [];

        for (let time in totalData) {
          if (!totalData[time].length) {
            newData.push({
              date: +new Date(time),
              map: { 1: 0, 2: 4, 3: 0, 4: 0, 5: 2, 6: 1 },
              mapFile: {
                1: [],
                2: [],
                3: [],
                4: [],
                5: [],
                6: [],
              },
              list: [],
            });
          } else {
            newData.push(...totalData[time]);
          }
        }

        return newData;
      } catch (error) {}
    },
    // 客户确认状态
    handleCustomerStatus(customerStatus, data) {
      let { customerDate, id, testDate, testStatus } = data;
      customerDate =
        customerDate && String(customerDate).length === 13
          ? Math.floor(customerDate / 1000)
          : "";

      homeProductionStatus({
        customerDate,
        customerStatus,
        schedulingId: id,
        testDate,
        testStatus,
      })
        .then(() => {
          this.msgSuccess("操作成功");
          this.getHomeProductionAll(false);
        })
        .catch(() => {
          this.msgError("操作失败");
        })
        .finally(() => {
          this.dialogVisible = false;
        });
    },
    // 测试确认状态
    handleTestStatus(testStatus, data) {
      let { customerDate, id, testDate, customerStatus } = data;
      testDate =
        testDate && String(testDate).length === 13
          ? Math.floor(testDate / 1000)
          : "";

      homeProductionStatus({
        customerDate,
        customerStatus,
        schedulingId: id,
        testDate,
        testStatus,
      })
        .then(() => {
          this.msgSuccess("操作成功");
          this.getHomeProductionAll(false);
        })
        .catch(() => {
          this.msgError("操作失败");
        })
        .finally(() => {
          this.dialogVisible = false;
        });
    },
    // 客户确认选择日期
    handleSelDate(type, data) {
      this.currentSelTimeType = type;
      this.currentSelData = Object.assign({}, data);

      this.isTitle = type === 1 ? "客户确认日期" : "测试确认日期";
      this.dialogVisible = true;
      this.dateTime = "";

      if (type === 1 && data.customerDate) {
        this.dateTime = data.customerDate * 1000;
      }

      if (type === 2 && data.testDate) {
        this.dateTime = data.testDate * 1000;
      }
    },
    handleSubmit() {
      if (!this.dateTime) {
        this.msgWarning("请选择日期");
        return;
      }

      if (this.currentSelTimeType === 1) {
        const data = { ...this.currentSelData, customerDate: this.dateTime };
        this.handleCustomerStatus(2, data);
      }

      if (this.currentSelTimeType === 2) {
        const data = { ...this.currentSelData, testDate: this.dateTime };
        this.handleTestStatus(2, data);
      }
    },
    toPlanSchedule(item) {
      const { categoryId, computerId } = item;
      if (!this.checkRole(["factory"]) || !categoryId || !computerId) {
        return;
      }

      this.$router.push({
        name: "ProdPermit",
        params: {
          categoryId,
          computerId,
        },
      });
    },
    onCellClick(row, column) {
      switch (column?.label) {
        case "型号":
          this.toPlanSchedule(row);
          break;
      }
    },
    onDbClick(row, column, cell, event) {
      switch (column?.label) {
        case "JS脚本":
          this.onCellStateClick(row, row.map[1], row?.mapFile[1]?.length);
          break;
        case "硬件资料":
          this.onCellStateClick(row, row.map[2], row?.mapFile[2]?.length);
          break;
        case "软件资料":
          this.onCellStateClick(row, row.map[3], row?.mapFile[3]?.length);
          break;
        case "配置文件":
          this.onCellStateClick(row, row.map[4], row?.mapFile[4]?.length);
          break;
        case "测试上位机":
          this.onCellStateClick(row, row.map[5], row?.mapFile[5]?.length);
          break;
      }
    },
    tableRowClassName({ row, rowIndex }) {
      return this.isToday(row.date) ? "success-row" : "";
    },
    getCellClassName({ row, column }) {
      const { map, mapFile, hopeDate, result, date, computerName } = row;
      const { label } = column;
      switch (label) {
        case "型号":
          return computerName && this.checkRole(["factory"]) ? "pointer" : "";
        case "JS脚本":
          return this.getDataState(map[1], mapFile[1]?.length);
        case "硬件资料":
          return this.getDataState(map[2], mapFile[2]?.length);
        case "软件资料":
          return this.getDataState(map[3], mapFile[3]?.length);
        case "配置文件":
          return this.getDataState(map[4], mapFile[4]?.length);
        case "测试上位机":
          return this.getDataState(map[5], mapFile[5]?.length);
        case "任务令":
          return row.qrCode ? "pointer" : "";
      }
    },
    getDataState(state, fileLen) {
      if (!fileLen) return null;
      switch (state) {
        case 0: // 待上传
        case 1: // 待审核
        case 2: // 测试审核通过
        case 3: // 未通过
          return "pointer";
      }
    },
    // 查看任务令
    handleQrCode(row) {
      this.isQrCode = true;
      this.qrCodeObj = row;
    },
  },
};
</script>
<style>
.success-row {
  background: #ebfae2 !important;
}
</style>
<style lang="scss">
.bg-success {
  background-color: #c6efce !important;
}
.bg-primary {
  background-color: #00b0f0 !important;
}
.bg-warning {
  background-color: #ffc000 !important;
}
.bg-danger {
  background-color: #f56c6c !important;
}
.bg-yellow {
  background-color: yellow !important;
}
.bg-header-lightBlue {
  background-color: #92cddc !important;
}
.bg-header-deepBlue {
  background-color: #00b0f0 !important;
}
.bg-green-noHurry {
  background-color: green;
}
.font-black {
  color: #000;
}
.font-correct {
  color: #007b74;
}

.plan-order-table {
  .el-table__body {
    .el-table__row {
      .el-table__cell {
        padding: 4px 0 !important;
      }
    }
  }
}
</style>
